all: new

clean:
	rm *~ *.o request worker server
	
new: server request worker

packet: packet.cpp packet.h
	g++ -w -c packet.cpp

servbuffer: servbuffer.cpp servbuffer.h
	g++ -w -c servbuffer.cpp -lpthread

clientbuffer: clientbuffer.cpp clientbuffer.h
	g++ -w -c clientbuffer.cpp -lpthread

lsp: lsp.c lsp.h
	g++ -w -c lsp.c

lex: lex.cpp
	g++ -w -c lex.cpp

lspmessage: lspmessage.pb.cc
	g++ -w -c lspmessage.pb.cc

request: request.cpp packet servbuffer clientbuffer lsp lex lspmessage
	g++ -g -w request.cpp -o request packet.o servbuffer.o clientbuffer.o lsp.o lex.o lspmessage.pb.o -lpthread -lcrypto -lnsl -lprotobuf

worker: worker.cpp packet servbuffer clientbuffer lsp lex lspmessage
	g++ -g -w worker.cpp -o worker packet.o servbuffer.o clientbuffer.o lsp.o lex.o lspmessage.pb.o -lpthread -lcrypto -lnsl -lprotobuf

server: server.cpp lex packet servbuffer clientbuffer lsp lspmessage
	g++ -g -w server.cpp -o server packet.o servbuffer.o clientbuffer.o lex.o lsp.o lspmessage.pb.o -lpthread -lcrypto -lnsl -lprotobuf

#inc:	
#	export LDFLAGS=$LDFLAGS:$HOME/local/lib